package tech.horgee.mapper;

import org.apache.ibatis.annotations.Mapper;
import tech.horgee.common.MyBaseMapper;
import tech.horgee.entity.User;

import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * 用户信息 Mapper 接口
 *
 * @author haojun
 * @since 2022-06-12
 */
@Mapper
public interface UserMapper extends MyBaseMapper<User> {

    default Map<Long, String> getNameMapByIds(Set<Long> userIds) {
        return selectBatchIds(userIds).stream().collect(Collectors.toMap(User::getUserId, User::getNickname));
    }
}
